#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'


## Extensions
import os
import sys

from docutils.parsers.rst import directives
sys.path.append(os.path.abspath('../extensions/'))
sys.path.append(os.path.abspath('../shared/extensions/'))

extensions = [
    'sphinx.ext.todo',
    'code_language_tabs',
    'markdown_reader',
    'metadata'
]

# refers to the build_sitemap extension
sitemap_url = 'http://docs.delta.io'

templates_path = ['_templates']

source_suffix = {'.md': 'markdown'}

master_doc = 'index'

# General information about the project.
project = 'Delta Lake'
author = 'Delta Lake Authors'

# generate_docs.py enforces that this is set.
version = os.environ["_DELTA_LAKE_RELEASE_VERSION_"]  # Replaced by copybara
release = version

# Prevent us from shooting ourselves in the foot and unintentionally using an OLD version
# for the NEXT release.
del os.environ["_DELTA_LAKE_RELEASE_VERSION_"]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []

# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'colorful' # seems to be overridden by read_the_docs_theme

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

html_context = {
    'use_algolia': '1'
}

html_theme_path = ["../theme/", "../shared/theme/"]
html_theme = 'delta'
html_title = "Delta Lake Documentation"

html_logo = "_static/delta-lake-white.png"
html_favicon = "_static/favicon.ico"

html_theme_options = {}

html_last_updated_fmt = "%b %d, %Y"

html_show_copyright = False

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# A shorter title for the navigation bar.  Default is the same as html_title.
#
# html_short_title = None

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
# html_use_smartypants = True

# If true, links to the reST sources are added to the pages.
#
html_show_sourcelink = False

html_add_permalinks = " "

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'Delta Lake'



# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'documentation', 'Delta Lake Documentation',
     [author], 1)
]

# If true, show URL addresses after external links.
#
# man_show_urls = False


latex_documents = [
        (master_doc, 'documentation.latex', 'Delta Lake Documentation',
            [author], 1)
        ]
